import request from '@/plugins/axios';
import qs from 'qs';
export default {
  // 初始获取所有数据
  getCarinsuranceList() {
    return request({
      url: `car/getAllCarInsurance`,
      method: 'get'
    });
  },
  // 新增数据
  AddCarData(addCar) {
    return request({
      url: `car/addCarInsuranceInfo`,
      method: 'POST',
      data: {
        carId: addCar.carId,
        insuranceCom: addCar.insuranceCom,
        insuranceNum: addCar.insuranceNum,
        insuranceStartDate: addCar.insuranceStartDate,
        insuranceEndDate: addCar.insuranceEndDate,
        trafficInsuranceNum: addCar.trafficInsuranceNum,
        trafficInsuranceStartDate: addCar.trafficInsuranceStartDate,
        trafficInsuranceEndDate: addCar.trafficInsuranceEndDate
      }
    });
  },
  // 删除数据
  DelCarinsuranceData(delId) {
    return request({
      url: `car/delCarInsuranceInfo`,
      method: 'get',
      params: {
        id: delId
      }
    });
  },
  // 搜索数据
  SearchCarinsuranceData(carId) {
    return request({
      url: `car/getCarInsuranceInfoById`,
      method: 'get',
      params: {
        id: carId
      }
    });
  },
  // 修改数据
  EditCarinsuranceData(form) {
    return request({
      url: `car/editCarInsuranceInfo`,
      method: 'post',
      data: {
        id: form.id,
        insuranceCom: form.insuranceCom,
        insuranceNum: form.insuranceNum,
        insuranceStartDate: form.insuranceStartDate,
        insuranceEndDate: form.insuranceEndDate,
        trafficInsuranceNum: form.trafficInsuranceNum,
        trafficInsuranceStartDate: form.trafficInsuranceStartDate,
        trafficInsuranceEndDate: form.trafficInsuranceEndDate
      }
    });
  }
};
